[MSIL] Variable comparison
Posted
by alexn
on Stack Overflow
See other posts from Stack Overflow
or by alexn
Published on 2010-03-22T15:06:25Z
Indexed on
2010/03/22
15:11 UTC
Read the original article
Hit count: 521
Hi,
The following C#-snippet:
var x = 1;
var y = 1;
if (x == y)
Console.Write("True");
Generates this MSIL:
.locals init (
[0] int32 x,
[1] int32 y,
[2] bool CS$4$0000)
L_0000: nop
L_0001: ldc.i4.1
L_0002: stloc.0
L_0003: ldc.i4.1
L_0004: stloc.1
L_0005: ldloc.0
L_0006: ldloc.1
L_0007: ceq
L_0009: ldc.i4.0
L_000a: ceq
L_000c: stloc.2
L_000d: ldloc.2
L_000e: brtrue.s L_001b
L_0010: ldstr "True"
L_0015: call void [mscorlib]System.Console::Write(string)
L_001a: nop
L_001b: ret
Why is there two ceq
calls?
Thanks
© Stack Overflow or respective owner